#define _CRT_SECURE_NO_WARNINGS 1
#include<string.h>
#include<stdio.h>
void my_qsort(void* base, size_t num, size_t size, int (*compare)(const void*, const void*))
{
	int i = 0;
	int j = 0;
	char* start = (char*)base;
	char tem[16];
	for (i = 0; i < num-1; i++)
	{
		for (j = 0; j < num - i - 1; j++)
		{
			if (compare(start + j * size, start + j * size + size))
			{
				memcpy(tem, start + j * size, size);
				memcpy(start + j * size, start + j * size + size, size);
				memcpy(start + j * size + size, tem, size);
			}
		}
	}
}
int compare(const void* a, const void* b)
{
	char* a = (char*)_a;    
	char* b = (char*)_b;
	return *a - *b;
}
int main()
{
	char str[10] = { 'a','b','c','d','e','f','g','h','i' ,'j'};
	my_qsort(str, sizeof(st), sizeof(str[1]), compare);
}